// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package kind

// SessionState
// 场次状态.
type SessionState int

const (
	SessionStateWaiting   SessionState = 1
	SessionStateOnSale    SessionState = 2
	SessionStateStarted   SessionState = 3
	SessionStateStopped   SessionState = 4
	SessionStateCompleted SessionState = 5
	SessionStateCancelled SessionState = 9
)

var (
	sessionStateTexts = map[SessionState]string{
		SessionStateWaiting:   "待开售",
		SessionStateOnSale:    "销售中",
		SessionStateStarted:   "作钓中",
		SessionStateStopped:   "结束作钓",
		SessionStateCompleted: "已完成",
		SessionStateCancelled: "已取消",
	}
	sessionStateUndefined = ""

	sessionStateFlags = map[SessionState]string{
		SessionStateWaiting:   "waiting",
		SessionStateOnSale:    "on-sale",
		SessionStateStarted:   "started",
		SessionStateStopped:   "stopped",
		SessionStateCompleted: "completed",
		SessionStateCancelled: "cancelled",
	}
	sessionStateUnknownFlag = ""
)

func (o SessionState) Flag() string {
	if str, ok := sessionStateFlags[o]; ok {
		return str
	}
	return sessionStateUnknownFlag
}

func (o SessionState) IsWaiting() bool   { return o == SessionStateWaiting }
func (o SessionState) IsOnSale() bool    { return o == SessionStateOnSale }
func (o SessionState) IsStarted() bool   { return o == SessionStateStarted }
func (o SessionState) IsStopped() bool   { return o == SessionStateStopped }
func (o SessionState) IsCompleted() bool { return o == SessionStateCompleted }

func (o SessionState) Text() string {
	if str, ok := sessionStateTexts[o]; ok {
		return str
	}
	return sessionStateUndefined
}
